﻿using WpfAGVSystem.DBModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace WpfAGVSystem.InterFace
{
   public interface IDBInterface
    {

        IEnumerable<Task_Entity> WhereTask() ;

        /// <summary>
        /// 查询符合条件得数量
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="tableName"></param>
        /// <param name="conditions"></param>
        /// <returns></returns>
        long Count<T>(Expression<Func<T, bool>> exception = null) where T : BaseDbmodel;

        /// <summary>
        /// 按照条件查询表数据第一条数据，默认是升序
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="conditions"></param>
        /// <returns></returns>
        T FirstOrDefault<T>(Expression<Func<T, bool>> exception = null) where T : BaseDbmodel;

        /// <summary>
        /// 根据条件查询
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="exception"></param>
        /// <returns></returns>
        IEnumerable<T> Where<T>(Expression<Func<T, bool>> exception = null) where T : BaseDbmodel;
        public IEnumerable<Task_Entity> SearchTask(Expression<Func<Task_Entity, bool>> exception = null, Expression<Func<TaskType_Entity, bool>> exception2 = null);

        bool Update<T>(T t) where T :  class, new();

        bool Delete<T>(Expression<Func<T, bool>> exception) where T : class, new();

        bool Delete<T>() where T : BaseDbmodel;
        bool Add<T>(T t) where T :  class, new();
        // bool Creat<T1>(T1 t1 ,TaskInfo taskInfo) where T1 : BaseDbmodel;
        // bool Creat<T1, T2>(T1 t1, T2 t2, TaskInfo taskInfo) where T1 : BaseDbmodel where T2 : BaseDbmodel;

            //  bool UpdateTaskinfo<T1, T2>(TaskInfo taskInfo) where T1 : BaseLockDBmodel where T2 : BaseLockDBmodel;
    }
}
